import { find, filter, cloneDeep } from "lodash-es";


// 页面按需单独引用即可，debounce, throttle


// _.find(users, function(o) { return o.age < 40; });
// // => object for 'barney'
 
// // The `_.matches` iteratee shorthand.
// _.find(users, { 'age': 1, 'active': true });
// // => object for 'pebbles'
 
// // The `_.matchesProperty` iteratee shorthand.
// _.find(users, ['active', false]);
// // => object for 'fred'
 
// // The `_.property` iteratee shorthand.
// _.find(users, 'active');
// // => object for 'barney'

export const findItem = (list, predicate, index = 0) => {
  return find(list, predicate, index)
};

// var users = [
//   { 'user': 'barney', 'age': 36, 'active': true },
//   { 'user': 'fred',   'age': 40, 'active': false }
// ];
 
// _.filter(users, function(o) { return !o.active; });
// // => objects for ['fred']
 
// // The `_.matches` iteratee shorthand.
// _.filter(users, { 'age': 36, 'active': true });
// // => objects for ['barney']
 
// // The `_.matchesProperty` iteratee shorthand.
// _.filter(users, ['active', false]);
// // => objects for ['fred']
 
// // The `_.property` iteratee shorthand.
// _.filter(users, 'active');
// // => objects for ['barney']
export const filterItem = (list, predicate) => {
  return filter(list, predicate)
};


// var objects = [{ 'a': 1 }, { 'b': 2 }];
 
// var deep = _.cloneDeep(objects);
// console.log(deep[0] === objects[0]);
// // => false
export const cloneDeep = (list, predicate) => {
  return cloneDeep(list, predicate)
};